package main

import (
	"fmt"
	"io/ioutil"
	"net/http"

	"code.byted.org/gopkg/logid"
	"code.byted.org/videoarch/ace_gateway_lib"
)

func main() {
	url := "https://ppe-tjjnsx.vegamews.volces.com/prometheus"
	httpReq, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		panic(err)
	}
	logID := logid.GenLogID()
	httpReq.Header.Set("X-Tt-Logid", logID)
	httpReq.SetBasicAuth("byted", "Bytedance123")
	fmt.Println(logID)
	scheme := "http"
	accessKey := "prometheus-ak"
	secretKey := "prometheus-sk"

	if err := ace_gateway_lib.SignAceGatewayProxyAuthToRequest(
		ace_gateway_lib.VersionV3,
		ace_gateway_lib.ProxyModeDirect,
		"100.65.0.180:31080", scheme, "",
		accessKey, secretKey, httpReq); err != nil {
		panic(err)
	}
	resp, err := http.DefaultClient.Do(httpReq)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	respData, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		panic(err)
	}
	fmt.Println(string(respData), err, resp.StatusCode)
}
